<template>
	<a-card>
		<template #title>
			<slot v-if="hasSlot('dataViewItemTitle')" name="dataViewItemTitle"></slot>
		</template>
		<template #actions>
			<slot
				v-if="hasSlot('dataViewItemActions')"
				name="dataViewItemActions"
			></slot>
		</template>
		<template #cover>
			<slot v-if="hasSlot('dataViewItemCover')" name="dataViewItemCover"></slot>
		</template>
		<template #customTab>
			<slot
				v-if="hasSlot('dataViewItemCustomTab')"
				name="dataViewItemCustomTab"
			></slot>
		</template>
		<template #extra>
			<slot v-if="hasSlot('dataViewItemExtra')" name="dataViewItemExtra"></slot>
		</template>
		<template #tabBarExtraContent>
			<slot
				v-if="hasSlot('dataViewItemTabBarExtraContent')"
				name="dataViewItemTabBarExtraContent"
			></slot>
		</template>
		<slot v-if="hasSlot('default')" name="default"></slot>
		<a-card-meta v-else :description="item.srfdescription">
			<template #title>
				<slot
					v-if="hasSlot('dataViewItemTitle')"
					name="dataViewItemTitle"
				></slot>
				<span v-else class="data-view-item__title">{{
					item.srfmajortext
				}}</span>
			</template>
			<template #avatar>
				<slot v-if="hasSlot('dataViewItemIcon')" name="dataViewItemIcon"></slot>
				<img v-else :src="item.srficon" />
			</template>
		</a-card-meta>
	</a-card>
</template>
<script setup lang="ts">
import { DataViewItemProps } from '../data-view';
const props = defineProps(DataViewItemProps);
const hasSlot = (name: string): boolean => {
	return !!useSlots()[name];
};
</script>
